home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / report.xul < prev    next >
Extensible Markup Language  |  2010-01-15  |  5KB  |  173 lines

  1. <?xml version="1.0"?> 
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  6. <?xml-stylesheet href="chrome://dwhelper/skin/dwhelper.css" type="text/css"?>
  7. <?xml-stylesheet href="chrome://dwhelper/content/bindings.css" type="text/css"?>
  8.  
  9. <!DOCTYPE window SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  10.  
  11. <window id="dwhelper-report"
  12.         title="&title.report;"
  13.         flex="1"
  14.         onload="onLoad()"
  15.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  16.         xmlns:html="http://www.w3.org/1999/xhtml"
  17.         persist="screenX screenY"
  18.         >
  19.  
  20.     <script type="application/x-javascript"
  21.         src="chrome://dwhelper/content/dwhutil.js" />
  22.  
  23.     <script><![CDATA[
  24.  
  25. var Util=Components.classes["@downloadhelper.net/util-service;1"]
  26.     .getService(Components.interfaces.dhIUtilService);
  27.  
  28. function onLoad() {
  29.     var x=document.documentElement.getAttribute("screenX");
  30.     var y=document.documentElement.getAttribute("screenY");
  31.     window.moveTo(x,y);
  32.     document.getElementById("name").focus();
  33. }
  34.  
  35. function submitSite() {
  36.     var nameField=document.getElementById("name");
  37.     var urlField=document.getElementById("url");
  38.     var authorField=document.getElementById("author");
  39.     var descriptionField=document.getElementById("description");
  40.     var adult=document.getElementById("adult");
  41.     
  42.     var name=nameField.value;
  43.     if(name.length==0) {
  44.         Util.alertError(Util.getText("error.report.name-too-short"));
  45.         nameField.focus();
  46.         return;
  47.     }
  48.     var url=urlField.value;
  49.     if(url.length==0) {
  50.         Util.alertError(Util.getText("error.report.url-too-short"));
  51.         urlField.focus();
  52.         return;
  53.     }
  54.     var author=authorField.value;
  55.     var description=descriptionField.value;
  56.     if(description.length<128) {
  57.         Util.alertError(Util.getText("error.report.description-too-short"));
  58.         descriptionField.focus();
  59.         return;
  60.     }
  61.     
  62.     var obj={
  63.         site: name,
  64.         url: url,
  65.         description: description,
  66.         author: author,
  67.         adult: adult.checked?"1":"0",
  68.         verif: "true"
  69.     };
  70.     
  71.     var body=DWHUtil.urlEncodeObject(obj);
  72.         
  73.     var cb=function(status,req,args) {
  74.         if(status==false) {
  75.             Util.alertError(Util.getText("error.report.connection"));
  76.         } else {
  77.             //Util.alertWarning(Util.getText("message.report.success"));
  78.         }
  79.         window.close();
  80.         window.location="about:blank"; // !!! mandatory to actually close the window on windows
  81.     }
  82.     
  83.     DWHUtil.loadAsync("http://www.downloadhelper.net/report.php",cb,{ window: window.self },body,"POST", 
  84.         { contentType: "application/x-www-form-urlencoded" });
  85.  
  86.     document.getElementById("main-panel").setAttribute("hidden","true");
  87.     document.getElementById("dwhelper-wait-panel").setAttribute("hidden","false");
  88.     setTimeout(function() {window.sizeToContent();},0);
  89. }
  90.  
  91. ]]>
  92.     </script>
  93.     
  94.     <vbox>
  95.  
  96.     <vbox id="main-panel">
  97.                 
  98.         <groupbox>
  99.             <caption label="&caption.report.report;"/>
  100.             
  101.             <description>&message.report.check-new;</description>
  102.             
  103.             <grid id="dwhelper-add-report">
  104.                 <columns>
  105.                     <column/>
  106.                     <column flex="1"/>
  107.                 </columns>
  108.                 <rows>
  109.                     <row>
  110.                         <label value="&label.report.name;"/>
  111.                         <vbox>
  112.                             <textbox id="name"/>
  113.                             <description>&help.report.name;</description>
  114.                         </vbox>
  115.                     </row>
  116.                     <row>
  117.                         <label value="&label.report.url;"/>
  118.                         <vbox>
  119.                             <textbox id="url"/>
  120.                             <description>&help.report.url;</description>
  121.                         </vbox>
  122.                     </row>
  123.                     <row>
  124.                         <label value="&label.report.author;"/>
  125.                         <vbox>
  126.                             <textbox id="author"/>
  127.                             <description>&help.report.author;</description>
  128.                         </vbox>
  129.                     </row>
  130.                     <row>
  131.                         <label value="&label.report.description;"/>
  132.                         <vbox>
  133.                             <textbox id="description" multiline="true" rows="5"/>
  134.                             <description>&help.report.description;</description>
  135.                         </vbox>
  136.                     </row>
  137.                     <row>
  138.                         <spacer/>
  139.                         <checkbox id="adult" label="&label.report.adult;"/>
  140.                     </row>
  141.                 </rows>
  142.             </grid>
  143.  
  144.             <hbox class="dwhelper-button-line">
  145.                 <spacer flex="1"/>
  146.                 <button label="&button.report.submit;" oncommand="submitSite()"/>
  147.                 <button id="close-but" label="&button.report.close;" oncommand="window.close()"/>
  148.             </hbox>
  149.  
  150.         </groupbox>
  151.             
  152.     </vbox>
  153.     
  154.     <vbox id="dwhelper-wait-panel" hidden="true">
  155.         <spacer flex="1"/>
  156.         <hbox>
  157.             <spacer flex="1"/>
  158.             <label value="&label.report.wait;"/>
  159.             <spacer flex="1"/>
  160.         </hbox>
  161.         <spacer flex="1"/>
  162.         <hbox>
  163.             <spacer flex="1"/>
  164.             <image class="waiter" src="chrome://dwhelper/skin/dwhelper24-anim.gif"/>
  165.             <spacer flex="1"/>
  166.         </hbox>
  167.         <spacer flex="1"/>
  168.     </vbox>
  169.     
  170.     </vbox>
  171.  
  172. </window>
  173.